﻿using DevExpress.XtraGrid.Demos.util;
using Luna小店.DTO;
using mendian;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Luna小店.UC.工序管理.service
{
    public class 工序Service
    {
        /// <summary>
        /// 获取全部工序
        /// </summary>
        /// <returns></returns>
        public static List<wbsItemDTO> get全部工序(String wbsTemplateId)
        {
            DTO工序管理 DTO工序管理 = FunctionHelper.JsonDeserialization<DTO工序管理>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/project/findWBSTemplateDByIdAndSaveCache?wbsTemplateId=" + wbsTemplateId
                        )
                    );
            return DTO工序管理.wbsItemDTOList;


        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static wbsItemDTO get点击单个工序(String code)
        {
            return
                FunctionHelper.JsonDeserialization<wbsItemDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/project/getWBSItemByCode?code=" + code
                        )
                    );
        }
    }
    
    public class DTO工序管理
    {
        public String id { get; set; }
        public String templateName { get; set; }
        public List<wbsItemDTO> wbsItemDTOList { get; set; } = new List<wbsItemDTO>();
        public DTO工序管理()
        {

        }

    }

    public class wbsItemDTO  //整个工序管理中的每个工序
    {
        public String id { get; set; }
        public String parentId { get; set; }
        public String name { get; set; }
        public String code { get; set; }
        public String index { get; set; }
        public List<achievementTemplateDTO> achievementTemplateDTOS { get; set; } = new List<achievementTemplateDTO>();
        public wbsItemDTO()
        {

        }

    }

    public class achievementTemplateDTO
    {

    }

}
